/**
 * 自定义filter
 * 
 * @author YangSh
 * @date 2017.4.19
 */
define(['angular'],function(angular){
	var filterModule = angular.module('filterModule', ['nl2brModule','strToDateModule']);
	/**
	 * 替换当前竖直的换行符
	 */  	
	angular.module('nl2brModule', [])
	 	.filter('nl2br', function() {
	 	    var span = document.createElement('span');
	 	    return function(input) {
	 	        if (!input) return input;
	 	        var lines = input.split('\n');
	 	        for (var i = 0; i < lines.length; i++) {
	 	            span.innerText = lines[i];
	 	            span.textContent = lines[i];  //for Firefox
	 	            lines[i] = span.innerHTML;
	 	        }
	 	        return lines.join('<br/>');
	 	    }
 	});
	
	/**
	 * 字符串转成日期格式
	 */
	angular.module('strToDateModule', [])
 	.filter('strtodate', function() {
 	    return function(value) {
 	    	if(undefined != value){
 	    		value = value.replace(/-/g,"/");
 	    	}else{
 	    		return;
 	    	}
 	    	var date = new Date(value);
 	        return date;
 	    }
	});
});